package com.erlang.springbootenable;

import com.erlang.springbootenableother.config.EnableUser;
import com.erlang.springbootenableother.config.MyImportBeanDefinitionRegistrar;
import com.erlang.springbootenableother.config.MyImportSelector;
import com.erlang.springbootenableother.config.UserConfig;
import com.erlang.springbootenableother.entity.Role;
import com.erlang.springbootenableother.entity.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;

/**
 * Import4中用法：
 *  1. 导入Bean
 *  2. 导入配置类
 *  3. 导入ImportSelector的实现类。
 *  4. 导入ImportBeanDefinitionRegistrar实现类
 */
@SpringBootApplication
//@Import({User.class,Role.class})
//@Import(UserConfig.class)
//@Import(MyImportSelector.class)
//@Import(MyImportBeanDefinitionRegistrar.class)
@EnableUser
public class SpringbootEnableApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringbootEnableApplication.class, args);
        User user = context.getBean(User.class);
        System.out.println("user = " + user);

        Role role = context.getBean(Role.class);
        System.out.println("role = " + role);
    }

}
